[Utility] 8진수, 16진수 뷰어

[ CnUnix ] in KIDS 글 쓴 이(By): yamang (*홀로서기*) 날 짜 (Date): 2000년 12월 14일 목요일 오전 07시 13분 53초 제 목(Title): 헥사나 옥탈코드 보는 툴 바이너리 화일의 헥사나 옥탈코드를 보고 싶은데 이거 보는 툴이 머가 있을까요. strings라는 툴은 바이너리에 텍스트 부분만 보여주는 거 맞나요?? [ CnUnix ] in KIDS 글 쓴 이(By): ahsarang (.아.사.랑.) 날 짜 (Date): 2000년 12월 14일 목요일 오전 08시 19분 33초 제 목(Title): Re: 헥사나 옥탈코드 보는 툴 od [ CnUnix ] in KIDS 글 쓴 이(By): terzeron (microkid) 날 짜 (Date): 2000년 12월 14일 목요일 오전 11시 08분 29초 제 목(Title): Re: 헥사나 옥탈코드 보는 툴 헥사 코드라면 Perl 책에 나오는 xdump 코드를 사용하는 것도 괜찮답니다. 그러면 왼쪽에는 offset, 중앙에는 헥사코드, 우편에는 아스키 문자가 출력되거든요. 이런 포맷이면 어디선가 많이 본 거죠? 00000080 20747265 652e0a23 20c0cc20 bdbac5a9 tree..# .. …. 00000090 b8b3c6ae b4c220c7 f6c0e720 b5f0b7ba …… …. …. 000000a0 c5e4b8ae bacec5cd 20726563 75727369 …….. recursi 000000b0 7665c7cf b0d4206d 7033c6c4 c0cfc0bb ve…. mp3…… 000000c0 20c3a3be c6bcad20 0a2320b1 d7b0cdc0 …… .# ….. #!/usr/bin/perl # # Usage: xdump [file] # # Use the file they specified, if specified open(STDIN, $ARGV[0]) || die “Can’t open $argv[0]: $!\n” if $ARGV[0]; # Do it optimally as long as we can read 16 bytes at a time while (($len = read(STDIN,$data,16)) == 16) { # hex code to hexadecimal number, N: a long in “network” order. @array = unpack(‘N4’, $data); # invert non-visible char to ‘.’ $data =~ tr/\0-\37\177-\377/./; printf “%8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %s\n”, $offset, @array, $data; $offset += 16; } # Now finish up the smaller end than 16 bytes, a byte at a time if ($len) { @array = unpack(‘C*’, $data); # C: an unsigned char value; $data =~ y/\0-\37\177-\377/./; # y is a synonym of tr. for (@array) { $_ = sprintf(‘%2.2x’, $_); } push(@array, ‘ ‘) while $len++ < 16; # fill right margin with ' ' $data =~ s/[^ -~]/./g; printf "%8.8lx ", $offset; printf "%s%s%s%s %s%s%s%s %s%s%s%s %s%s%s%s %s\n", @array, $data; }